package com.majun.base.mono;

import reactor.core.publisher.Mono;

public class MonoExample {
	public static void main(String[] args) {
		// 从静态数据创建
		Mono<String> mono1 = Mono.just("Hello, Mono");

		// 创建空的Mono
		Mono<String> mono2 = Mono.empty();

		// 创建包含错误的Mono
		Mono<String> mono3 = Mono.error(new RuntimeException("An error occurred"));

		// 订阅Mono
		mono1.subscribe(System.out::println);
		mono2.subscribe(System.out::println);
		mono3.subscribe(System.out::println, System.err::println);
	}
}
